#include "Sprite.h"
//---------------------------------------------------------------------------------------------//
Sprite::Sprite()
: texture(new Texture)
{
	vertices = new D3DVertexUV[4];
	
	vertices[0].setVertex(-64,64,0,0,0);
	vertices[1].setVertex(64,64,0,1,0);
	vertices[2].setVertex(-64,-64,0,0,1);
	vertices[3].setVertex(64,-64,0,1,1);
}
//---------------------------------------------------------------------------------------------//
void Sprite::Init(Graphics &g)
{
	texture = g.LoadTexture(L"Textures/wonderboy.bmp",0xffff00ff);
	animation = new Animation(vertices,texture,48,48,10);
}
//---------------------------------------------------------------------------------------------//
void Sprite::Draw(Graphics &g)
{
	g.SetMatrixMode(WORLD_MATRIX);
	g.LoadIdentity();
	g.SetTexture(texture);
	animation->animateSprite(50);
	g.DrawSpriteElements(4,vertices,TRIANGLESTRIP);
}